Handle 16 colour display mode. For some reason, in this mode
authorTor Lillqvist <tml@novell.com>
Tue, 5 Apr 2005 01:46:59 +0000 (01:46 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Tue, 5 Apr 2005 01:46:59 +0000 (01:46 +0000)
2005-04-05  Tor Lillqvist  <tml@novell.com>

* gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Handle 16 colour
display mode. For some reason, in this mode GetDeviceCaps(BITSPIXEL)
returns 1 (but GetDeviceCaps(NUMCOLORS) does return 16). (#143415)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gdk/win32/gdkvisual-win32.c

index d518ab0e57793fa549ff751e03b8904072f2c4a6..b3b185ac53710ec840bf8bb83ac128e1623733fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2005-04-05  Tor Lillqvist  <tml@novell.com>
 
+       * gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Handle 16 colour
+       display mode. For some reason, in this mode GetDeviceCaps(BITSPIXEL)
+       returns 1 (but GetDeviceCaps(NUMCOLORS) does return 16). (#143415)
+
        * gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Don't force
        24bpp GdkVisual on 32bpp displays. (#140706)
 
index d518ab0e57793fa549ff751e03b8904072f2c4a6..b3b185ac53710ec840bf8bb83ac128e1623733fc 100644 (file)
@@ -1,5 +1,9 @@
 2005-04-05  Tor Lillqvist  <tml@novell.com>
 
+       * gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Handle 16 colour
+       display mode. For some reason, in this mode GetDeviceCaps(BITSPIXEL)
+       returns 1 (but GetDeviceCaps(NUMCOLORS) does return 16). (#143415)
+
        * gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Don't force
        24bpp GdkVisual on 32bpp displays. (#140706)
 
index d518ab0e57793fa549ff751e03b8904072f2c4a6..b3b185ac53710ec840bf8bb83ac128e1623733fc 100644 (file)
@@ -1,5 +1,9 @@
 2005-04-05  Tor Lillqvist  <tml@novell.com>
 
+       * gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Handle 16 colour
+       display mode. For some reason, in this mode GetDeviceCaps(BITSPIXEL)
+       returns 1 (but GetDeviceCaps(NUMCOLORS) does return 16). (#143415)
+
        * gdk/win32/gdkvisual-win32.c (_gdk_visual_init): Don't force
        24bpp GdkVisual on 32bpp displays. (#140706)
 
index 445fd2297dceb50905f53fe8550c5db09110b51a..0007c47d6a8e41f2bf9106fc40783b428b49ce87 100644 (file)
@@ -97,20 +97,22 @@ _gdk_visual_init (void)
   HBITMAP hbm;
 
   const gint rastercaps = GetDeviceCaps (_gdk_display_hdc, RASTERCAPS);
+  const int numcolors = GetDeviceCaps (_gdk_display_hdc, NUMCOLORS);
   gint bitspixel = GetDeviceCaps (_gdk_display_hdc, BITSPIXEL);
   gint map_entries = 0;
 
   system_visual = g_object_new (GDK_TYPE_VISUAL, NULL);
 
+  GDK_NOTE (COLORMAP, g_print ("BITSPIXEL=%d NUMCOLORS=%d\n",
+                              bitspixel, numcolors));
+
   if (rastercaps & RC_PALETTE)
     {
       const int sizepalette = GetDeviceCaps (_gdk_display_hdc, SIZEPALETTE);
-      const int numcolors = GetDeviceCaps (_gdk_display_hdc, NUMCOLORS);
       gchar *max_colors = getenv ("GDK_WIN32_MAX_COLORS");
       system_visual->type = GDK_VISUAL_PSEUDO_COLOR;
 
-      GDK_NOTE (COLORMAP, g_print ("BITSPIXEL=%d NUMCOLORS=%d SIZEPALETTE=%d\n",
-                                  bitspixel, numcolors, sizepalette));
+      GDK_NOTE (COLORMAP, g_print ("SIZEPALETTE=%d\n", sizepalette));
       g_assert (sizepalette == 256);
 
       if (max_colors != NULL)
@@ -155,6 +157,12 @@ _gdk_visual_init (void)
       else
        map_entries = sizepalette;
     }
+  else if (bitspixel == 1 && numcolors == 16)
+    {
+      bitspixel = 4;
+      system_visual->type = GDK_VISUAL_STATIC_COLOR;
+      map_entries = 16;
+    }
   else if (bitspixel == 1)
     {
       system_visual->type = GDK_VISUAL_STATIC_GRAY;